package pkg

import (
	"encoding/json"
	"github.com/Baidu-AIP/golang-sdk/aip/censor"
)

type Test struct {
	LogId          uint   `json:"log_id"`
	ErrorCode      string `json:"error_code"`
	ErrorMsg       string `json:"error_msg"`
	Conclusion     string `json:"conclusion"`
	ConclusionType uint   `json:"conclusion_type"`
}

func Bdy(content string) bool {
	//通过access_toke
	client := censor.NewClient("loT7PtrAyjGkOAUE7vs2DRIh", "agwX4v4giNnTfdjBLxdEUHxQ5PMeSO6O")

	result := client.TextCensor(content)

	var data Test
	json.Unmarshal([]byte(result), &data)

	if data.ConclusionType == 1 {
		return true
	}
	return false

}

type Testing struct {
	LogId          uint   `json:"log_id"`
	ErrorCode      string `json:"error_code"`
	ErrorMsg       string `json:"error_msg"`
	Conclusion     string `json:"conclusion"`
	ConclusionType uint   `json:"conclusion_type"`
}

func DanMuByd(danmu string) bool {
	//通过access_toke
	client := censor.NewClient("loT7PtrAyjGkOAUE7vs2DRIh", "agwX4v4giNnTfdjBLxdEUHxQ5PMeSO6O")

	result := client.TextCensor(danmu)

	var data Testing
	err := json.Unmarshal([]byte(result), &data)
	if err != nil {
		return false
	}

	if data.ConclusionType == 1 {
		return false
	}
	return true

}
